﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace zielonka.co.uk.extensions.system
{
    /*
        var nullableDate = GetDateWhichCouldBeNull();
        Response.Write(nullableDate.NullDateToString("mm/dd/yy", "-no date found-"));
     */

    public static partial class DateTimeExtensions
    {
        public static string NullDateToString(this DateTime? dt, string format = "M/d/yyyy", string nullResult = "")
        {
            if (dt.HasValue)
                return dt.Value.ToString(format);
            else
                return nullResult;
        }
    }
}
